package sideral;

import Gerenciar.GerenciarCliente;
import Telas.CadastroParcerias;
import Telas.TelaCadastroCliente;
import Telas.CadastroServico;
import Telas.ConsultaCliente;
import Telas.ConsultaParceria;
import java.util.List;
import javax.swing.JDialog;

import javax.swing.JFrame;

/**
 * @author Guilherme Roberty
 */
public class Principal extends javax.swing.JFrame {

    public Principal() {
        initComponents();
        setExtendedState(JFrame.MAXIMIZED_BOTH);

    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenu1 = new javax.swing.JMenu();
        jDesktop = new javax.swing.JDesktopPane();
        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu5 = new javax.swing.JMenu();
        MenuNovoCliente = new javax.swing.JMenuItem();
        MenuNovaParceiria = new javax.swing.JMenuItem();
        MenuServico = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();
        MenuCliente = new javax.swing.JMenuItem();
        MenuParceiria = new javax.swing.JMenuItem();
        MenuConsultaServico = new javax.swing.JMenuItem();

        jMenu1.setText("jMenu1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jDesktop.setToolTipText("");
        jDesktop.setAutoscrolls(true);
        jDesktop.setDesktopManager(null);

        jMenu5.setText("Cadastros");

        MenuNovoCliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        MenuNovoCliente.setText("Novo Cliente");
        MenuNovoCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuNovoClienteActionPerformed(evt);
            }
        });
        jMenu5.add(MenuNovoCliente);

        MenuNovaParceiria.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F2, 0));
        MenuNovaParceiria.setText("Nova Parceiria");
        MenuNovaParceiria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuNovaParceiriaActionPerformed(evt);
            }
        });
        jMenu5.add(MenuNovaParceiria);

        MenuServico.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0));
        MenuServico.setText("Serviços");
        MenuServico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuServicoActionPerformed(evt);
            }
        });
        jMenu5.add(MenuServico);

        jMenuBar2.add(jMenu5);

        jMenu6.setText("Consulta");

        MenuCliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, 0));
        MenuCliente.setText("Cliente");
        MenuCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuClienteActionPerformed(evt);
            }
        });
        jMenu6.add(MenuCliente);

        MenuParceiria.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        MenuParceiria.setText("Parceria");
        MenuParceiria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuParceiriaActionPerformed(evt);
            }
        });
        jMenu6.add(MenuParceiria);

        MenuConsultaServico.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, 0));
        MenuConsultaServico.setText("Serviço");
        jMenu6.add(MenuConsultaServico);

        jMenuBar2.add(jMenu6);

        setJMenuBar(jMenuBar2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktop, javax.swing.GroupLayout.DEFAULT_SIZE, 1550, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktop, javax.swing.GroupLayout.DEFAULT_SIZE, 870, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void MenuNovoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuNovoClienteActionPerformed
        TelaCadastroCliente.getInstance().setVisible(true);
        jDesktop.add(TelaCadastroCliente.getInstance());

    }//GEN-LAST:event_MenuNovoClienteActionPerformed

    private void MenuNovaParceiriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuNovaParceiriaActionPerformed
        CadastroParcerias.getInstance().setVisible(true);
        jDesktop.add(CadastroParcerias.getInstance());
    }//GEN-LAST:event_MenuNovaParceiriaActionPerformed

    private void MenuServicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuServicoActionPerformed
        CadastroServico.getInstance().setVisible(true);
        jDesktop.add(CadastroServico.getInstance());
       
        
    }//GEN-LAST:event_MenuServicoActionPerformed

    private void MenuClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuClienteActionPerformed
        ConsultaCliente.getInstance().setVisible(true);
        jDesktop.add(ConsultaCliente.getInstance());
    }//GEN-LAST:event_MenuClienteActionPerformed

    private void MenuParceiriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuParceiriaActionPerformed
        ConsultaParceria novaTela = new ConsultaParceria(this, rootPaneCheckingEnabled);
        novaTela.setVisible(true);
        novaTela.setLocationRelativeTo(null);
        
       
    }//GEN-LAST:event_MenuParceiriaActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem MenuCliente;
    private javax.swing.JMenuItem MenuConsultaServico;
    private javax.swing.JMenuItem MenuNovaParceiria;
    private javax.swing.JMenuItem MenuNovoCliente;
    private javax.swing.JMenuItem MenuParceiria;
    private javax.swing.JMenuItem MenuServico;
    private javax.swing.JDesktopPane jDesktop;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar2;
    // End of variables declaration//GEN-END:variables
    private static Principal instance = null;

    public static Principal getInstance() {
        if (instance == null) {
            instance = new Principal();
        }
        return instance;
    }
}
